/*
 * Copyright 2011 Angel Sanadinov
 *
 * This file is part of VBox WMI.
 *
 * VBox WMI is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * VBox WMI is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with VBox WMI.  If not, see <http://www.gnu.org/licenses/>.
 */

package Beans.Requests.UserManagement;

import Beans.Requests.RequestBean;
import Utilities.Constants;
import Utilities.Functions;

/**
 * This is the superclass for all user management requests.
 *
 * @author Angel Sanadinov
 */
public abstract class UserManagementRequest extends RequestBean
{
    private int affectedUserId; //the id of the affected user

    /**
     * No-argument constructor. <br><br>
     * All fields are set to their invalid values.
     */
    public UserManagementRequest()
    {
        this.affectedUserId = Constants.INVALID_USER_ID;
    }

    /**
     * Retrieves the affected user's id.
     *
     * @return the user id
     */
    public int getAffectedUserId()
    {
        return affectedUserId;
    }

    /**
     * Sets the affected user's id.
     *
     * @param userId the id of the affected user
     */
    public void setAffectedUserId(int userId)
    {
        this.affectedUserId = userId;
    }

    /**
     * Checks if the affected user's id is valid.
     *
     * @return <code>true</code> if the id is valid or <code>false</code> otherwise
     */
    protected boolean isAffectedUserIdValid()
    {
        return Functions.isUserIdValid(affectedUserId);
    }
}
